import request from '../utils/request.js'
// 获取所有频道选项卡
export const getAllChannelsApi = () => {
  return request({
    url: '/v1_0/channels',
    method: 'GET'
  })
}

//  获取用户选择的频道
// 注意: 用户没有登录,默认返回后台设置的默认频道列表
export const getUserChannelApi = () => {
  return request({
    url: '/v1_0/user/channels',
    method: 'GET'
  })
}

// 修改用户已选择频道的Api(用户新添加频道)
export const updateChannelApi = (channels) => {
  console.log(channels)
  return request({
    url: '/v1_0/user/channels',
    method: 'PUT',
    data: channels
  })
}

// 删除用户选定频道
export const removeChannelApi = (target) => {
  return request({
    url: `/v1_0/user/channels/${target}`,
    method: 'DELETE',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}